import { createRouter, createWebHistory } from "vue-router";

const router = createRouter({
    history: createWebHistory(),
    routes: [{
        path: '/',
        redirect: '/inedx',
        component: () =>
            import ('../pages/Index.vue'),
        meta: { title: '首页' },
        children: [{
                path: '/category',
                name: 'category',
                component: () =>
                    import ('../pages/subpages/category.vue'),
                meta: { title: '分类管理' }
            },
            {
                path: '/goods',
                name: 'goods',
                component: () =>
                    import ('../pages/subpages/goods.vue'),
                meta: { title: '商品管理' }
            },
            {
                path: '/user',
                name: 'user',
                component: () =>
                    import ('../pages/subpages/user.vue'),
                meta: { title: '个人中心' }
            },
            {
                path: '/index',
                name: 'index',
                component: () =>
                    import ('../pages/subpages/index.vue'),
                meta: { title: '首页' }
            },

        ],
    }, {
        path: '/login',
        name: 'login',
        component: () =>
            import ('../pages/Login.vue'),
        meta: { title: '登录' }
    }]
})
export default router;